<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="cn.edu.scau.cmi.carol.javabean.Conn" %>
<%@ page import="cn.edu.scau.cmi.carol.javabean.User" %>
<%@ page import="cn.edu.scau.cmi.carol.sex.Sex" %>
<%@ page import="java.sql.*" %>    
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>studentUpdate_deal</title>
</head>
<body>
<%-- <jsp:useBean id="user" class="cn.edu.scau.cmi.carol.javabean.User"></jsp:useBean>
<jsp:setProperty property="*" name="user"/> --%>
<%
try{
	User user=(User)request.getAttribute("user");
	Connection conn=Conn.connect();
	String updatesql="update student set sex=?,age=?,password=? where studentID=?";
	PreparedStatement ps=conn.prepareStatement(updatesql);
	ps.setInt(1,Sex.sexToInt(user.getSex()));
	ps.setInt(2,user.getAge());
	ps.setString(3,user.getPassword());
	ps.setInt(4,user.getStudentID());
	int row=ps.executeUpdate();
	if(row>0){
		out.print("ok!");
	}
	ps.close();
	conn.close();
}
catch(Exception e){
	out.print("failed.");
}
%>
back_to<a href="studentMain.jsp">main</a>
</body>
</html>